<?php

namespace common\models\workin_tables;

use Yii;

/**
 * This is the model class for table "{{%car_invonce_verify_huirong}}".
 *
 * @property integer $id
 * @property string $grant_key
 * @property string $api_key
 * @property string $business_code
 * @property string $pic
 * @property string $pic_net_path
 * @property integer $pic_type
 * @property string $call_back
 * @property string $order_report_id
 * @property string $search_index
 *
 * @property CarInvonceVerifyHuirongBack $carInvonceVerifyHuirongBack
 */
class CarInvonceVerifyHuirong extends \yii\db\ActiveRecord
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return '{{%car_invonce_verify_huirong}}';
    }

    /**
     * @return \yii\db\Connection the database connection used by this AR class.
     */
    public static function getDb()
    {
        return Yii::$app->get('db_workin');
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['grant_key', 'api_key', 'pic_type', 'call_back', 'order_report_id', 'search_index'], 'required'],
            [['pic_type'], 'integer'],
            [['grant_key', 'api_key', 'business_code', 'pic', 'pic_net_path', 'call_back'], 'string', 'max' => 200],
            [['order_report_id'], 'string', 'max' => 30],
            [['search_index'], 'string', 'max' => 50],
            [['order_report_id'], 'unique'],
            [['search_index'], 'unique'],
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'id' => Yii::t('app', 'ID'),
            'grant_key' => Yii::t('app', 'Grant Key'),
            'api_key' => Yii::t('app', 'Api Key'),
            'business_code' => Yii::t('app', 'Business Code'),
            'pic' => Yii::t('app', 'Pic'),
            'pic_net_path' => Yii::t('app', 'Pic Net Path'),
            'pic_type' => Yii::t('app', 'Pic Type'),
            'call_back' => Yii::t('app', 'Call Back'),
            'order_report_id' => Yii::t('app', 'Order Report ID'),
            'search_index' => Yii::t('app', 'Search Index'),
        ];
    }

    /**
     * @return \yii\db\ActiveQuery
     */
    public function getCarInvonceVerifyHuirongBack()
    {
        return $this->hasOne(CarInvonceVerifyHuirongBack::className(), ['car_invonce_verify_huirong_id' => 'id']);
    }
}
